#include<bits/stdc++.h>
using namespace std;

#define REP(i, l, r) for(int i = l; i <= r; ++i)
#define RREP(i, l, r) for(int i = l; i >= r; --i)
#define _REP(i, l, r, _) for(int i = l; i <= r; i += _)
#define _RREP(i, l, r, _) for(int i = l; i >= r; i -= _)

const int N = 1e5 + 10;

int n, a[N], s1, s2, ans;

int main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);

    scanf("%d", &n);
    REP(i, 1, n) scanf("%d", a + i);
    sort(a + 1, a + 1 + n);
    REP(i, 1, n)
    {
        if(s1) s1--, ans++;
        s2++;
        if(a[i] != a[i + 1])
        {
            s1 += s2;
            s2 = 0;
        }
    }
    printf("%d", n - ans);
    return 0;
}
